//
//  SetupPasswordController.m
//  DianDangDai
//
//  Created by bhf on 2017/12/21.
//  Copyright © 2017年 bhf. All rights reserved.
//

#import "SetupPasswordController.h"

@interface SetupPasswordController ()

@end

@implementation SetupPasswordController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"安全设置";
    // Do any additional setup after loading the view.
}
//2885.54
//6214912800326519 刘永富
- (void)setupViews {
    self.bottomBtn.layer.cornerRadius = 22;
}
- (IBAction)commit:(UIButton *)sender {
    
    NSString *urlString = [NSString stringWithFormat: @"%@OPT=1044&&password=%@&confirmPassword=%@&sign=%@",API_LOGIN_URL_STRING,_newpwd.text,_confirmPwd.text,USER_SIGN];
    
    NSLog(@"%@",urlString);
    [[CDHttpHelper defaultCDHttpHelper] get:urlString params:nil success:^(id responseObj) {
        NSDictionary *dict = [responseObj objectFromJSONData];
        NSLog(@"%@",dict);
        [self.view makeToast:dict[@"msg"]];
        if ([dict[@"code"] isEqualToString:@"0"]) {
            UIViewController *vc = [LOGIN_STORYBOARD instantiateViewControllerWithIdentifier:@"alc"];
            NSUserDefaults *df = [NSUserDefaults standardUserDefaults];
            [df synchronize];
            [df setObject:@"No" forKey:@"login"];
            [df removeObjectForKey:@"userInformation"];
            [self presentViewController:vc animated:YES completion:nil];
        }
    } failure:^(NSError *error) {
        
    } showHUD:YES];

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
